<template>
  <div class="reportFormPage">
    <!--    <topOperation/>-->
    <div id="domid">
      <el-row>
        <el-col :span="5" :offset="19">
          <div class="pageNumBox">
            <span>第</span>
            <span>&nbsp;{{ form.page }}&nbsp;</span>
            <span>页，共</span>
            <span>&nbsp;{{ form.totalPage }}&nbsp;</span>
            <span>页</span>
          </div>
        </el-col>
      </el-row>
      <div class="topTwoBox">
        <div class="centerName">沥青针入度、延度、软化点试验检测记录表</div>
        <div class="codeText">
          <tr>JGLQ01008</tr>
        </div>
      </div>
      <div class="threeTopBox">
        <div class="threeItem1" style="width: 90px">检测单位名称：</div>
        <div class="threeItem2">
          <span>{{ form.jiancdwmc }}</span>
        </div>
        <div class="threeItem1" style="width: 65px">记录编号：</div>
        <div class="threeItem2">
          <el-input type="text" v-model="form.jilbh" class="height100 bg-white" />
        </div>
      </div>
      <!-- .........................1111111111111111111111111111111......................................................... -->
      <table border="1" height="220px" bordercolor="#000000" cellpadding="2" cellspacing="0" align="center">
        <tbody>
          <tr>
            <td height="25" align="center" width="15%">
              <span style="width: 90px; display: inline-block">工程名称</span>
            </td>
            <td width="35%" class="text-center">
              <span>{{ form.gongcmc }}</span>
            </td>
            <td align="center" width="15%">
              <span style="width: 90px; display: inline-block">工程部位/用途</span>
            </td>
            <td width="35%" class="text-center">
              <span>{{ form.gongcbwyt }}</span>
            </td>
          </tr>
          <tr>
            <td height="50" align="center">样品信息</td>
            <td style="word-wrap: break-word; word-break: break-all;text-align:left" colspan="3">
              <span>样品名称：</span>
              <span>{{ form.yangpmc }}</span>
              <span>；样品编号：</span>
              <el-input type="text" v-model="form.yangpbh" style="width: 42%; height: auto" />
              <span>；样品数量：</span>
              <span>{{ form.yangpsl }}</span>
              <span>；样品状态：</span>
              <span>{{ form.yangpzt }}</span>
              <span>；来样时间：</span>
              <span>{{ form.yangpsj }}</span>
            </td>
          </tr>

          <tr>
            <td height="25" align="center" width="15%">
              <span style="width: 90px; display: inline-block">试验检测日期</span>
            </td>
             <!-- <td width="35%" class="text-center">{{ form.shiyjcrq }}</td> -->                                            
 <td width="35%" class="text-center">
      <el-input v-model="form.shiyjcrq" />
</td>
            <td align="center" width="15%">
              <span style="width: 90px; display: inline-block">试验条件</span>
            </td>
            <td width="35%">
              温度：
              <el-input type="number" v-model="form.shiytjwd" class="height100" style="width: 15%" />
              ℃；湿度：
              <el-input type="number" v-model="form.shiytjsd" class="height100" style="width: 15%" />
              %RH
            </td>
          </tr>

          <tr>
            <td height="25" align="center" width="15%">
              <span style="width: 90px; display: inline-block">检测依据</span>
            </td>
            <td width="35%">
              <el-input type="text" v-model="form.jiancyj" class="height100 width100" />
            </td>
            <td align="center" width="15%">
              <span style="width: 90px; display: inline-block">判定依据</span>
            </td>
            <td width="35%">
              <el-input type="text" v-model="form.pandyj" class="height100 width100" />
            </td>
          </tr>

          <tr>
            <td height="30" align="center">主要仪器设备<br />名称及编号</td>
            <td colspan="3">
              <el-input type="textarea" @dblclick.native="showBsInstrumentView" :rows="2" v-model="form.zhuyyqsbmcjbh"
                class="height100 width100 mark" readonly>
              </el-input>
              <!-- <el-button type="text" @click="showBsInstrumentView"><i class="el-icon-search"></i></el-button> -->
            </td>
          </tr>
        </tbody>
      </table>
      <!-- .................................沥青种类及产地............................................... -->
      <table class="kind-table" border="1">
        <tbody>
          <tr>
            <td class="small">取样地点</td>
            <td class="large"><input type="text" v-model="form.quydd"/></td>
            <td class="small">沥青产地</td>
            <td class="large"><input type="text" v-model="form.liqcd"/></td>
          </tr>
          <tr>
            <td class="small">沥青种类</td>
            <td class="large"><input type="text" v-model="form.liqzl"/></td>
            <td class="small">沥青标号</td>
            <td class="large"><input type="text" v-model="form.liqbh"/></td>
          </tr>
        </tbody>
      </table>
      <!-- .................................沥青针入度（针入度指数）试验............................................... -->
      <table class="custom-table" border="1">
        <tbody>
          <tr>
            <td colspan="7" class="centered">沥青针入度（针入度指数）试验</td>
          </tr>
          <tr>
            <td rowspan="2">试样编号</td>
            <td rowspan="2">试验温度（℃）</td>
            <td colspan="5" class="centered">针入度(0.1mm)</td>
          </tr>
          <tr>
            <td>第一次测值①</td>
            <td>第二次测值②</td>
            <td>第三次测值③</td>
            <td>针入度</td>
            <td>针入度指数</td>
          </tr>
          <!-- <tr v-for="(row, index) in zrdRows" :key="index" :id="'zrd_' + index">
            <td>{{index + 1}}</td>
            <td><input type="text" v-model="form.quydd"/></td>
            <td><input type="text" v-model="form.quydd"/></td>
            <td><input type="text" v-model="form.quydd"/></td>
            <td><input type="text" v-model="form.quydd"/></td>
            <td></td>
            <template v-if="index === 0">
              <td :rowspan="5">
                <input type="text" v-model="form.quydd"/>
              </td>
            </template>
          </tr> -->
          <tr v-for="(row, index) in rows" :key="index">
            <td>{{index + 1}}</td>
            <td><input type="text" v-model="row.shiywd"></td>
            <td><input type="text" v-model="row.diyccz"></td>
            <td><input type="text" v-model="row.dieccz"></td>
            <td><input type="text" v-model="row.disccz"></td>
            <td><input type="text" v-model="row.zhenrd" disabled></td>
            <template v-if="index === 0">
              <td :rowspan="5">
                <input type="text" v-model="form.zhenrdzs" disabled/>
              </td>
            </template>
          </tr>
        </tbody>
      </table>
      <!-- .................................沥青延度试验............................................... -->
      <table class="custom-table" border="1">
        <tbody>
          <tr>
            <td colspan="7" class="centered">沥青延度试验</td>
          </tr>
          <tr>
            <td rowspan="2">试样编号</td>
            <td rowspan="2">试验温度（℃）</td>
            <td rowspan="2">延伸速度（cm/min）</td>
            <td colspan="4" class="centered">延度(0.1mm)</td>
          </tr>
          <tr>
            <td>试件1测值</td>
            <td>试件2测值</td>
            <td>试件3测值</td>
            <td>平均值</td>
          </tr>
          <tr v-for="(row, index) in ydRows" :key="index">
            <td>{{index + 1}}</td>
            <td><input type="text" v-model="row.shiywd"></td>
            <td><input type="text" v-model="row.yanssd"></td>
            <td><input type="text" v-model="row.shij1cz"></td>
            <td><input type="text" v-model="row.shij2cz"></td>
            <td><input type="text" v-model="row.shij3cz"></td>
            <td><input type="text" v-model="row.pingjz" disabled></td>
          </tr>
        </tbody>
      </table>
      <!-- .................................沥青软化点试验............................................... -->
      <table class="custom-table" border="1">
        <tbody>
          <tr>
            <td colspan="20" class="centered">沥青软化点试验</td>
          </tr>
          <tr>
            <td rowspan="2">试样编号</td>
            <td rowspan="2">烧杯内液体名称</td>
            <td colspan="16" class="centered">烧杯中液体每分钟末温度上升记录（℃）</td>
            <td colspan="2">软化点（℃）</td>
          </tr>
          <tr>
            <td>开始</td>
            <td>1</td>
            <td>2</td>
            <td>3</td>
            <td>4</td>
            <td>5</td>
            <td>6</td>
            <td>7</td>
            <td>8</td>
            <td>9</td>
            <td>10</td>
            <td>11</td>
            <td>12</td>
            <td>13</td>
            <td>14</td>
            <td>15</td>
            <td>测值</td>
            <td>平均值</td>
          </tr>
          <tr v-for="(row, index) in rhdRows" :key="index">
            <td>{{index + 1}}</td>
            <td><input type="text" v-model="row.shaobnytmc"></td>
            <td><input type="text" v-model="row.kais"></td>
            <td><input type="text" v-model="row.tempv1"></td>
            <td><input type="text" v-model="row.tempv2"></td>
            <td><input type="text" v-model="row.tempv3"></td>
            <td><input type="text" v-model="row.tempv4"></td>
            <td><input type="text" v-model="row.tempv5"></td>
            <td><input type="text" v-model="row.tempv6"></td>
            <td><input type="text" v-model="row.tempv7"></td>
            <td><input type="text" v-model="row.tempv8"></td>
            <td><input type="text" v-model="row.tempv9"></td>
            <td><input type="text" v-model="row.tempv10"></td>
            <td><input type="text" v-model="row.tempv11"></td>
            <td><input type="text" v-model="row.tempv12"></td>
            <td><input type="text" v-model="row.tempv13"></td>
            <td><input type="text" v-model="row.tempv14"></td>
            <td><input type="text" v-model="row.tempv15"></td>
            <td><input type="text" v-model="row.cez"></td>
            <td><input type="text" v-model="row.pingjz"></td>
          </tr>
        </tbody>
      </table>
      <!-- .....................................................33333333333333333................................................... -->
      <table cellpadding="2" cellspacing="0" bordercolor="#000000" style="
          width: 100%;
          border-right: 2px solid black;
          border-left: 2px solid black;
          border-top-style: none;
          border-bottom: 2px solid black;
          border-collapse: collapse;
          margin: none;
        ">
        <tbody>
          <tr>
            <td height="30" align="center">附加声明：</td>
            <td colspan="3">
              <el-input type="textarea" :rows="2" v-model="form.fujsm" />
            </td>
          </tr>
        </tbody>
      </table>

      <!-- .................................44444444444............................................. -->
      <table border="0" cellpadding="0" cellspacing="0" align="center"
        style="width: 100%; border-collapse: collapse; height: 22px" class="transparent">
        <tbody>
          <tr>
            <td width="10%" align="right">检测：</td>
            <td width="15%" align="left"></td>
            <td width="10%" align="right">记录：</td>
            <td width="15%" align="left"></td>
            <td width="10%" align="right">批准：</td>
            <td align="left" width="15%"></td>
            <td width="10%">日期：</td>
            <td align="left" width="15%">
              <div style="display: inline-block; margin-left: 20px">年</div>
              <div style="display: inline-block; margin-left: 20px">月</div>
              <div style="display: inline-block ;margin-left: 20px">日</div>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
    <bs-instrument-view ref="bsInstrumentViewRef" @select="selectInstrument"></bs-instrument-view>
  </div>
</template>

<script>
import {
  getLqLqzrdjlbBsInfo,
} from "@/api/report_lq/lqLqzrdjlbBsInfo";
import BsInstrumentView from "@/views/dept/bsInstrument/BsInstrumentView.vue";
import decimal from "@/utils/big-decimal";
import Bus from '@/utils/bus';

export default {
  name: "lqzrdjlb",
  components: {
    BsInstrumentView,
  },
  props: {
    excelId: {
      type: [String, Number],
      default: () => ""
    },
  },
  data () {
    return {
      // 表单参数
      form: {},
      zrdRows:  5, // 默认有5行
      rows: [ //this.rows = responseData; // 将后端返回的数据赋值给 rows 数组
        { shiybh: '1', shiywd: '', diyccz: '', dieccz: '', disccz: '', zhenrd: '', zhenrdzs: '' },
        { shiybh: '2', shiywd: '', diyccz: '', dieccz: '', disccz: '', zhenrd: '', zhenrdzs: '' },
        { shiybh: '3', shiywd: '', diyccz: '', dieccz: '', disccz: '', zhenrd: '', zhenrdzs: '' },
        { shiybh: '4', shiywd: '', diyccz: '', dieccz: '', disccz: '', zhenrd: '', zhenrdzs: '' },
        { shiybh: '5', shiywd: '', diyccz: '', dieccz: '', disccz: '', zhenrd: '', zhenrdzs: '' },
      ],
      ydRows: [ //this.rows = responseData; // 将后端返回的数据赋值给 rows 数组
        { shiybh: '1', shiywd: '', yanssd: '', shij1cz: '', shij2cz: '', shij3cz: '', pingjz: '' },
        { shiybh: '2', shiywd: '', yanssd: '', shij1cz: '', shij2cz: '', shij3cz: '', pingjz: '' },
      ],
      rhdRows: [ //this.rows = responseData; // 将后端返回的数据赋值给 rows 数组
        { shiybh: '1', shaobnytmc: '', kais: '', tempv1: '', tempv2: '', tempv3: '', tempv4: '',tempv5: '', 
        tempv6: '', tempv7: '', tempv8: '' ,tempv9: '', tempv10: '', tempv11: '', tempv12: '' , tempv13: '', tempv14: '', tempv15: '', cez: '' , pingjz: ''  },
        { shiybh: '2', shaobnytmc: '', kais: '', tempv1: '', tempv2: '', tempv3: '', tempv4: '',tempv5: '', 
        tempv6: '', tempv7: '', tempv8: '' ,tempv9: '', tempv10: '', tempv11: '', tempv12: '' , tempv13: '', tempv14: '', tempv15: '', cez: '' , pingjz: ''  },
      ],
    };
  },
  created () {
    this.getInfo()
  },
  mounted () {
  },
  beforeDestroy () { // 或者你可以使用其他合适的生命周期钩子
    // 停止监听事件
    Bus.$off('meicjsChange');
    Bus.$off('ganmdpjzChange');
    Bus.$off('zuidgmdChange');
    Bus.$off('zuijhslChange');
  },
  methods: {
    // 获取详情
    getInfo () {
      if (!this.excelId) {
        return
      }
      getLqLqzrdjlbBsInfo(this.excelId).then(response => {
        this.form = response.data;
        if (response.data.zrdList.length != 0) {
          this.rows = response.data.zrdList
        }
        if (response.data.ydList.length != 0) {
          this.ydRows = response.data.ydList
        }
        if (response.data.rhdList.length != 0) {
          this.rhdRows = response.data.rhdList
        }
      });
    },
    // 显示仪器列表
    showBsInstrumentView () {
      this.$refs.bsInstrumentViewRef.init(this.form.shebIds);
    },
    // 仪器选择
    selectInstrument (info) {
      this.form.zhuyyqsbmcjbh = info.label;
      this.form.shebIds = info.ids;
    },
    // 计算压实度
    calculateYasd (type) {
      if (!this.form["ganmd" + type] || !this.form["zuidgmd"]) {
        return;
      }
      //  压实度 = 表一平均干密度 / 最大干密度
      this.form["yasd" + type] = decimal.divide(
        this.form["ganmd" + type],
        this.form["zuidgmd"]
      )
    },
  }
}
</script>

<style scoped>
.kind-table {
    width: 100%;
    border-collapse: collapse;
    border-top: none;
  }
  .kind-table td {
    border: 1px solid black;
    padding: 8px;
    height: 30px;
    text-align: center;
  }
  small {
    width: 16.67%; /* 设置小列宽度 */
  }
  .large {
    width: 33.33%; /* 设置大列宽度 */
  }
  .kind-table input {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    border: none;
    text-align: center;
    background-color: white; /* 设置input背景为白色 */
  }
.custom-table {
  width: 100%;
  border-top: none;
}
.custom-table td {
  width: 50px;
  height: 30px;
  text-align: center;
  border: 1px solid black;
}

.custom-table input {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  border: none;
  text-align: center;
  background-color: white; /* 设置input背景为白色 */
}

.td1 {
  width: calc(100% / 16 * 1);
}

.td2 {
  width: calc(100% / 16 * 2);
}

.td3 {
  width: calc(100% / 16 * 3);
}

.td4 {
  width: calc(100% / 16 * 4);
}

.td5 {
  width: calc(100% / 16 * 5);
}

.td6 {
  width: calc(100% / 16 * 6);
}
</style>
